{% extends "blog/themes/%s/base.html" % config.theme %}
{% block title %}{{config.blog_name}}{% endblock %}
{% block body %}
	{# newly installed blog with no_post #}
	{% if no_post %}
	  <h2>Welcome to the The O-Kay-Blog</h2>
		<p>Your flashy new blog needs some content!</p>
		<p>Create some new posts at the Admin Page.</p>
		<p>
		<a href="/admin/newpost">Go to the Admin Page.</a>
		</p>	
	{% endif %}
  {% for post in posts %}
    <h2><a href="{{post.path}}">{{post.title|e}}</a></h2>
    <p class="post-info">
      Posted by {{config.author_name}}
      {% if post.tags %}
        | Filed under
        {% for tag in post.tag_pairs %}
          <a href="/tag/{{tag[1]|e}}">{{tag[0]|e}}</a>{% if not loop.last %},{% endif %}
        {% endfor %}
      {% endif %}
    </p>
    {{post.summary|safe}}
    <p class="postmeta">
      <a href="{{post.path}}" class="readmore">Read more</a>
      {% if config.disqus_forum %}
       | <a href="{{post.path}}#disqus_thread" class="readmore">Comments</a>
      {% endif %}
      <span class="date">{{post.published|date("%d %B, %Y")}}</span>
    </p>
  {% endfor %}
  {% if prev_page %}
    <a id="prev" href="{{prev_page}}">Newer</a>
  {% endif %}
  {% if next_page %}
    <a id="next" href="{{next_page}}">Older</a>
  {% endif %}
  {% if config.disqus_forum %}
    <script type="text/javascript">
    //<![CDATA[
    (function() {
      var links = document.getElementsByTagName('a');
      var query = '?';
      for(var i = 0; i < links.length; i++) {
      if(links[i].href.indexOf('#disqus_thread') >= 0) {
        query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
      }
      }
      document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/{{config.disqus_forum}}/get_num_replies.js' + query + '"></' + 'script>');
    })();
    //]]>
    </script>
  {% endif %}
{% endblock %}
